package cn.qyd.kaoshi;

/**
 * @author 邱运铎
 * @date 2024-04-11 20:26
 */
public class StrTransterHT {
    public static void main(String[] args) {
        //        String str = "createAccountMode";
//        String str = "userId32Mark";
//        String str = "ERPNoProductTT";
        String str = "ERPNWesddPPrasPP";

        char[] chars = str.toCharArray();

        StringBuilder st = new StringBuilder();
        for (int i = 0; i < chars.length; i++) {
            char c = chars[i];

            if ('A' <= c && c <='Z') {
                if (i + 1 < chars.length && i -1 >= 0) {
                    char pre = chars[i - 1];
                    char next = chars[i + 1];
                    if ((pre < 'A' || pre > 'Z') || (next < 'A' || next > 'Z')) {
                        st.append("_");
                    }
                }
            }

            st.append(c);
        }

        System.out.println(st);
    }
}
